home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-07-11 | 352 b | 23 lines | [TEXT/ttxt] |
- ; calculates a^b
- ; where a is in R0=> b in R1 and the answer in R0
- copy a=>Reg0
- copy b=>reg1
- jump:subroutine power
- halt
- noop
- power
- copy reg0=>reg2 ;save the value
- copy 1=>reg0
- looptop
- compare 0=>reg1
- jump:greater_equal endit
- multiply reg2=>reg0 ;
- subtract 1=>reg1
- jump:always looptop
- endit
- return
- noop
- a constant 5
- b constant 4
- end
-